#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;


void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> h(n + 1);
    for(int i = 1; i <= n; i++) cin >> h[i];
    map<int, int> mp;
    while(m--)
    {
        int a, b;
        cin >> a >> b;
        if(h[b] > mp[a]) mp[a] = h[b];
        if(h[a] > mp[b]) mp[b] = h[a];
    }
    int ans = 0;
    for(int i = 1; i <= n; i++)
    {
        if(h[i] > mp[i])
            ans++;
    }
    cout << ans << endl;
}

int main() {
    int t = 1;
    // cin >> t;
    while(t--) solve();
    return 0;
}